package com.mallcloud.mall.common.core.constant.enums.mall;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 订单
 */
@Getter
@AllArgsConstructor
public enum OrderEnum {

	//字典
	REDEEM_STATUS("", ""),
	;

	private final String type;
	private final String description;

	@Getter
	@AllArgsConstructor
	public enum StatusEnum {
		PENDING(1, "待处理"),
		SUCCESS(2, "回调成功"),
		PAY_TIMEOUT(3, "订单支付超时"),
		FAIL(9, "回调失败"),
		;
		private Integer status;
		private String description;

		public static String getDecs(Integer status) {
			return Arrays.stream(values()).filter(x -> x.getStatus().equals(status)).findFirst().get().getDescription();
		}
	}

	@Getter
	@AllArgsConstructor
	public enum StatusRefundEnum {
		PENDING(2, "已支付"),//(默认)
		SUCCESS(8, "退款成功"),
		FAIL(9, "退款失败"),
		;
		private Integer status;
		private String description;

		public static String getDecs(Integer status) {
			return Arrays.stream(values()).filter(x -> x.getStatus().equals(status)).findFirst().get().getDescription();
		}
	}

	@Getter
	@AllArgsConstructor
	public enum PayedEnum {
		PAYED(true, "已支付"),
		NOT_PAY(false, "未支付"),
		;
		private Boolean status;
		private String description;

		public static String getDecs(Boolean status) {
			return Arrays.stream(values()).filter(x -> x.getStatus().equals(status)).findFirst().get().getDescription();
		}
	}

	@Getter
	@AllArgsConstructor
	public enum DiscountTypeEnum {
		AUTO(1, "电子券抵扣"),
		MANUAL(2, "手工券抵扣"),
		;
		private Integer type;
		private String description;

		public static String getDecs(Integer type) {
			return Arrays.stream(values()).filter(x -> x.getType().equals(type)).findFirst().get().getDescription();
		}
	}

	@Getter
	@AllArgsConstructor
	public enum TypeEnum {
		ORDER_PARK("ORDER_PARK", "停车订单"),
		ORDER_COUPON("ORDER_COUPON", "券订单"),
		ORDER_VALUE_CARD_RECHARGE("ORDER_VALUE_CARD_RECHARGE", "储值卡充值订单"),
		POINT_GOODS_COUPON("POINT_GOODS_COUPON", "积分商品订单"),
		;
		private String type;
		private String description;

		public static String getDecs(String type) {
			return Arrays.stream(values()).filter(x -> x.getType().equals(type)).findFirst().get().getDescription();
		}
	}

}
